//
//  BBLargeImageView.h
//  LargeImage
//
//  Created by box on 14-3-25.
//  Copyright (c) 2014年 box. All rights reserved.
//

#import <UIKit/UIKit.h>


@protocol BBLargeImageViewDataSource;
@protocol BBLargeImageViewDelegate;

@interface BBLargeImageView : UIView

+ (instancetype)largeImageView;
- (void)reloadData;
- (void)setCurIndex:(NSInteger)curIndex after:(NSTimeInterval)delayTime animated:(BOOL)animated;

@property (nonatomic,assign)id<BBLargeImageViewDataSource> dataSource;
@property (nonatomic,assign)id<BBLargeImageViewDelegate> delegate;

@property (nonatomic,assign,readonly)NSInteger count;
@property (nonatomic,assign)NSInteger curIndex;
@property (nonatomic,assign,readonly)UIImageView *visibleImageView;
@property (nonatomic,assign)BOOL enableDoSomeThingBtn;

//底部的工具条
@property (retain, nonatomic) IBOutlet UIView *toolBarView;

//添加、移除、隐藏、显示本view时自动加动画(移除动画在removeOnGoBack为YES时有效)
@property (nonatomic,assign)BOOL autoAnimate;

//点击返回时自动移除本view
@property (nonatomic,assign)BOOL removeOnGoBack;

//点击图片时自动移除本view
@property (nonatomic,assign)BOOL removeOnTouchImage;

//添加到父视图时，将本view的frame设为父视图的bounds
@property (nonatomic,assign)BOOL adjustFrameToSuperView;

//给中间那个按钮（默认是保存图片到相册）改变响应事件和标题
- (void)doSomethingBtnChangeTarget:(id)aTarget action:(SEL)aSelector title:(NSString *)aTitle;


@end





@protocol BBLargeImageViewDataSource <NSObject>

@required
- (NSInteger)numberOfImagesInLargeImageView:(BBLargeImageView *)aLargeImageView;

@optional
//以下3个方法任选一个实现，且至少要实现一个，如果实现多个，则优先顺序从上往下

//!可以返回NSURL、UIImage和NSString三种对象，但是NSString必须是能转换为NSURL正确图片链接，建议使用这一个方法
- (id)largeImageView:(BBLargeImageView *)aLargeImageView urlOrImageAtIndex:(NSInteger)aIndex;
//!只能返回NSURL对象，不建议使用
- (NSURL *)largeImageView:(BBLargeImageView *)aLargeImageView urlForImageAtIndex:(NSInteger)aIndex NS_DEPRECATED(10_0, 10_4, 2_0, 2_0);
//!只能返回UIImage对象，不建议使用
- (UIImage *)largeImageView:(BBLargeImageView *)aLargeImageView imageAtIndex:(NSInteger)aIndex NS_DEPRECATED(10_0, 10_4, 2_0, 2_0);

@end






@protocol BBLargeImageViewDelegate <NSObject>

@optional

- (void)didClickGoBackOnLargeImageView:(BBLargeImageView *)aLargeImageView;

- (void)largeImageView:(BBLargeImageView *)aLargeImageView didClickImageAtIndex:(NSInteger)aIndex;

- (void)largeImageView:(BBLargeImageView *)aLargeImageView didScrollToImageAtIndex:(NSInteger)aIndex;

@end